package com.grq.mis.exception;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class ResultData<T> implements Serializable {

    private int code;
    private String msg;
    private T data;

    public ResultData(ResultEnum resultEnum) {
        this.msg = resultEnum.getMsg();
        this.code = resultEnum.getCode();
    }

    public ResultData(ResultEnum resultEnum, String msg) {
        this.msg = msg;
        this.code = resultEnum.getCode();
    }

    public ResultData(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public ResultData(T data, ResultEnum resultEnum) {
        this.data = data;
        this.msg = resultEnum.getMsg();
        this.code = resultEnum.getCode();
    }

    public ResultData(T data, ResultEnum resultEnum, String msg) {
        this.data = data;
        this.msg = msg;
        this.code = resultEnum.getCode();
    }

}
